<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test</title>
    <script>
        let el = console.log;
        let dl = console.dir;

        function User(name) {
            this.name = name
        }
        dl(User)

        /**
         * 注意点 不要使用下列方法去改变原型prototype指针指向
         */
        // User.prototype = {}   X错误 已点的方式即可

        //原型执行
        el(User.prototype.__proto__ == Object.prototype)   //true
        el(User.prototype.constructor == User)   //true

        var user = new User.prototype.constructor('dushenyna');
        el(user.name)
    </script>
</head>

<body>
    <h1>Test页面</h1>
</body>

</html>